<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="text" value="abc">
<input type="button" value="按钮" onclick="f()">
<div>div</div>
<span>span</span>

<script>
  //通过选择器找到页面中的div
  let d = document.querySelector("div");
  //修改div的内容
  d.innerText = "内容修改了";

  let s = document.querySelector("span");
  s.innerText = "span也改了";

  //得到页面中的文本框
  let i = document.querySelector("input");
  //修改控件的值
  i.value = "文本框内容改变了!";

function f() {
    d.innerText = i.value;
}

</script>

</body>
</html>